<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style lang="css">
    body {
      display: flex;
      justify-content: center;
      align-items: center;
      height: 100vh;
      background: lightblue;
    }

    .pagination {
      --active-index: 0;
      display: flex;
      padding: 10px 20px;
      background: white;
      border-radius: 50px;
      box-shadow: 0 0.3px 0.6px rgba(0, 0, 0, 0.056), 0 0.7px 1.3px rgba(0, 0, 0, 0.081), 0 1.3px 2.5px rgba(0, 0, 0, 0.1), 0 2.2px 4.5px rgba(0, 0, 0, 0.119), 0 4.2px 8.4px rgba(0, 0, 0, 0.144), 0 10px 20px rgba(0, 0, 0, 0.2);
      list-style-type: none;
    }

    .pagination li {
      margin: 0 5px;
    }

    .pagination li.page-number {
      width: 50px;
      height: 50px;
      line-height: 50px;
      text-align: center;
    }

    .pagination li.page-number:hover a {
      color: white;
      background: #777;
    }

    .pagination li.page-number.active a {
      color: white;
      background: #333;
    }

    .pagination li.page-prev,
    .pagination li.page-next {
      font-weight: 700;
    }

    .pagination li.page-prev {
      margin-right: 20px;
    }

    .pagination li.page-next {
      margin-left: 20px;
    }

    .pagination li a {
      display: block;
      line-height: 50px;
      font-size: 20px;
      font-weight: 600;
      text-decoration: none;
      color: #777;
      border-radius: 50%;
      transition: 0.3s;
    }

    .pagination li a.prev:hover,
    .pagination li a.next:hover {
      color: black;
    }
  </style>
</head>

<body>
  <ul class="pagination">
    <li class="page-prev">
      <a class="prev" href="#"><i class="fas fa-arrow-left"></i></a>
    </li>
    <li class="page-number active"><a href="#">1</a></li>
    <li class="page-number"><a href="#">2</a></li>
    <li class="page-number"><a href="#">3</a></li>
    <li class="page-number"><a href="#">4</a></li>
    <li class="page-number"><a href="#">5</a></li>
    <li class="page-number"><a href="#">6</a></li>
    <li class="page-next">
      <a class="next" href="#"><i class="fas fa-arrow-right"></i></a>
    </li>
  </ul>

</body>
<script>
  var prevLink = document.querySelector(".prev");
  var nextLink = document.querySelector(".next");
  var pagination = document.querySelector(".pagination");
  var pageNumberLinks = document.querySelectorAll(".page-number a");
  var maxPageIndex = pageNumberLinks.length - 1;
  pageNumberLinks.forEach(function (pageNumberLink, activeIndex)
  {
    pageNumberLink.addEventListener("click", function ()
    {
      pageNumberLinks.forEach(function (pageNumberLink)
      {
        return pageNumberLink.parentElement.classList.remove("active");
      });
      pageNumberLink.parentElement.classList.add("active");
      pagination.style.setProperty("--active-index", "" + activeIndex);
    });
  });
  prevLink.addEventListener("click", function ()
  {
    pageNumberLinks.forEach(function (pageNumberLink)
    {
      return pageNumberLink.parentElement.classList.remove("active");
    });
    var activeIndex = Number(pagination.style.getPropertyValue("--active-index"));
    activeIndex = activeIndex > 0 ? activeIndex - 1 : 0;
    pageNumberLinks[activeIndex].parentElement.classList.add("active");
    pagination.style.setProperty("--active-index", "" + activeIndex);
  });
  nextLink.addEventListener("click", function ()
  {
    pageNumberLinks.forEach(function (pageNumberLink)
    {
      return pageNumberLink.parentElement.classList.remove("active");
    });
    var activeIndex = Number(pagination.style.getPropertyValue("--active-index"));
    activeIndex = activeIndex < maxPageIndex ? activeIndex + 1 : maxPageIndex;
    pageNumberLinks[activeIndex].parentElement.classList.add("active");
    pagination.style.setProperty("--active-index", "" + activeIndex);
  });
</script>

</html>